﻿using System;
using System.Collections.Generic;
using System.Text;

namespace X3dTest
{
    public class Cylinder:Gemeotry
    {
        private string Bottom;

        public string bottom
        {
            get { return Bottom; }
            set { Bottom = value; }
        }
        private string Height;

        public string height
        {
            get { return Height; }
            set { Height = value; }
        }
        private string Radius;

        public string radius
        {
            get { return Radius; }
            set { Radius = value; }
        }
        private string Side;

        public string side
        {
            get { return Side; }
            set { Side = value; }
        }
        private string Top;

        public string top
        {
            get { return Top; }
            set { Top = value; }
        }
        private string Solid;

        public string solid
        {
            get { return Solid; }
            set { Solid = value; }
        }

        public Cylinder():base()
        {
            
        }

        public override  string getAttrs()
        {
            return "DEF|" + this.DEF + "|string,"
                    + "USE|" + this.USE + "|string,"
                    + "bottom|" + (this.bottom == null ? "true" : "false") + "|bool,"
                    + "height|" + (this.height == null ? "2" : this.height) + "|float,"
                    + "radius|" + (this.radius == null ? "1" : this.radius) + "|float,"
                    + "side|" + (this.side == null ? "true" : "false") + "|bool,"
                    + "solid|" + (this.solid == null ? "true" : "false") + "|bool,"
                    + "top|" + (this.top == null ? "true" : "false") + "|bool";
        }

        public override  void setAttrs(string attrs)
        {
            string[][] temp = X3DString.getArrayByAttrs(attrs);
            for (int i = 0; i < temp.Length; i++)
            {
                switch (temp[i][0])
                {
                    case "DEF":
                        this.DEF = temp[i][1];
                        break;
                    case "USE":
                        this.USE = temp[i][1];
                        break;
                    case "bottom":
                        this.bottom = temp[i][1];
                        break;
                    case "height":
                        this.height = temp[i][1];
                        break;
                    case "radius":
                        this.radius = temp[i][1];
                        break;
                    case "side":
                        this.side = temp[i][1];
                        break;
                    case "solied":
                        this.solid = temp[i][1];
                        break;
                    case "top":
                        this.top = temp[i][1];
                        break;
                }
            }
        }
    }
}
